<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('commerce_address', function (Blueprint $table) {
            $table->comment('快递地址信息');
            $table->bigIncrements('id')->comment('主键ID');
            $table->unsignedBigInteger('user_id')->nullable()->comment('所属用户ID');
            $table->string('name', 16)->nullable(false)->comment('姓名');
            $table->string('phone', 16)->nullable(false)->comment('手机号码');
            $table->string('province', 16)->nullable(false)->comment('省');
            $table->string('city', 16)->nullable(false)->comment('市');
            $table->string('district', 16)->nullable(false)->comment('区');
            $table->string('address', 64)->nullable(false)->comment('地址');
            $table->tinyInteger('is_default')->default(1)->comment('是否默认地址：1-否，2-是');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('commerce_address');
    }
};